
package org.jma.app.ewisdom.entities;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Vector;

import org.jma.lib.soap.utils.XMLSerializable;

import com.thoughtworks.xstream.XStream;
/**
 * EntityWithACL class is a generalization of {@link FileDescriptor} class and {@link Content} class 
 * used to give them support for Access List.<br>
 * There is no restriction about the ROL or Entity, only must be Strings  
 * @author Jesus Mari, jesmari@ono.com
 * @version 1.0
 * @since 1.0
 */
public class EntityWithACL implements Serializable,Cloneable{

	Vector ACL = new Vector();
	

	public void addEntityToACL(String entity,String rol){	
		ACL.add(new RolEntityPair(rol,entity));
	}
	public void removeEntityToACL(String entity,String rol){
		ACL.remove(new RolEntityPair(rol,entity));
	}
	public Vector getACLClone(){
		return (Vector) ACL.clone();
	}
	public void setACL(Vector acl){
		this.ACL=acl;
	}
	
	
	public boolean isInACL(String entity,String rol){
		return ACL.contains(new RolEntityPair(rol,entity));
	}	
	
	public Object clone() throws CloneNotSupportedException{	
		return super.clone();
	}
}
